home *** CD-ROM | disk | FTP | other *** search
/ PC Gamer (Italian) 30 / PC Gamer IT CD 30 1-2.iso / MOTS / GAMEDATA / EPISODE / JKM_PCG.GOO / cog_s1l2_ffieldswitch.cog < prev    next >
Text File  |  1998-02-25  |  3KB  |  124 lines

  1. # ForceFieldSwitch
  2. # Jedi Knight Cog Script
  3. #
  4. # S1L2_FFieldSwitch.cog
  5. #
  6. # this script activates a forcefield that damages a player on touch.
  7. # also sets this surface to be nomove and translucent.
  8. # Shooting or activating switch will turn it off.
  9. # Adapted from Steve's level 18 script
  10. #
  11. # [DB] (with Tim Longo on Bass)
  12. #
  13. # (C) 1997 LucasArts Entertainment Co. All Rights Reserved
  14.  
  15.  
  16. symbols
  17.  
  18. message     startup
  19. message     damaged
  20. message     activated
  21. message     touched
  22. message     timer
  23.  
  24. surface     switch                        linkid=1 mask=0x448
  25. surface     damsurf                       mask=0x408
  26. surface     damsurf2                      mask=0x408
  27. surface        damsurf3              mask=0x408
  28.                 
  29. flex        maxdamage=10.0
  30. flex        mindamage=5.0
  31. flex        damage=0.0                    local
  32.  
  33. #sound       powerup=ForceFieldOn01.wav    local
  34. sound       powerdown=ForceFieldOff01.wav local
  35. #sound       wav0=ForceFieldHum01.wav      local
  36. sound       wav1=ForceFieldHit01.wav      local
  37.  
  38.  
  39. int         garbage=0                     local
  40. int         garbage2=0                    local
  41.  
  42. thing       victim                        local
  43.  
  44. end
  45.  
  46.  
  47. code
  48. startup:
  49.        SetWallCel(switch,0);                   //on
  50.        ClearAdjoinFlags(damsurf,10);              //no move
  51.        ClearAdjoinFlags(damsurf2,10);
  52.        ClearAdjoinFlags(damsurf3,10);
  53.        SetFaceGeoMode(damsurf,0);              //translucent
  54.       SetFaceGeoMode(damsurf2,0);
  55.       SetFaceGeoMode(damsurf3,0);
  56.        SetSurfaceFlags(damsurf,16384);           //magsealed
  57.     SetSurfaceFlags(damsurf2,16384);
  58.        SetSurfaceFlags(damsurf3,16384);
  59. //       PlaySoundPos(wav0, GetSurfaceCenter(damsurf), 1.0, 1, 10, 0x1);
  60.  
  61.        return;
  62.  
  63. activated:
  64.        if (GetSenderID() != 1) return;
  65.  
  66.        if (GetWallCel(switch) == 0)
  67.           {
  68.               SetWallCel(switch,1);                     //off
  69.               PlaySoundLocal(powerdown, 1, 0, 0);
  70.               SetAdjoinFlags(damsurf,10);                  //move
  71.               SetAdjoinFlags(damsurf2,10);
  72.               SetAdjoinFlags(damsurf3,10);
  73.           }
  74. //       else if (GetWallCel(switch) == 1)
  75. //          {
  76. //              PlaySoundLocal(powerup, 1, 0, 0);
  77. //              SetWallCel(switch,0);                    //on
  78. //              ClearAdjoinFlags(damsurf,10);           //no move
  79. //              ClearAdjoinFlags(damsurf2,10);
  80. //              ClearAdjoinFlags(damsurf3,10);
  81. //          }
  82.            return;
  83.  
  84. touched:
  85.        if ((GetSenderRef() == damsurf) || (GetSenderRef() == damsurf2) || (GetSenderRef() == damsurf3))
  86.           {
  87.               victim = GetSourceRef();
  88.               damage = (Rand()*(maxdamage - mindamage))+mindamage;
  89.               garbage2 = DamageThing(victim, damage, 0x4, victim);
  90.                  PlaySoundPos(wav1, GetSurfaceCenter(damsurf), 0.5, 1, 10, 0);
  91.       
  92.              }
  93.  
  94. fieldflash:
  95.           SetFaceGeoMode(damsurf,4);
  96.           SetFaceGeoMode(damsurf2,4);
  97.           SetFaceGeoMode(damsurf3,4);
  98.         KillTimerEx(1);
  99.              SetTimerEx(0.5, 1, 0, 0);
  100.              return;
  101.  
  102. damaged:
  103.     if (GetWallCel(switch) == 1) return;
  104.  
  105.     if (GetSenderID() == 1)
  106.            {
  107.               call activated;
  108.            }
  109.        else
  110.            {
  111.               call fieldflash;
  112.            }
  113.  
  114.        return;
  115.  
  116. timer:
  117.        SetFaceGeoMode(damsurf,0);
  118.        SetFaceGeoMode(damsurf2,0);
  119.        SetFaceGeoMode(damsurf3,0);
  120.        Return;
  121.  
  122. end
  123.